@extends('layouts.app')

@section('content')
<example-component></example-component>
<hr>
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">创建新标签</div>

                <div class="card-body">
                    <form action="/tags" method="post">
                        @csrf
                      <div class="form-group">
                        <label for="tagName">标签名称</label>
                        <input type="text" class="form-control @error('name') is-invalid @enderror" id="tagName" name="name" aria-describedby="tagNameHelp">
                        <small id="tagNameHelp" class="form-text text-muted">标签名称</small>
                        @error('name')
                            <div class="alert alert-danger">{{ $message }}</div>
                        @enderror
                      </div>
                      <div class="form-group">
                        <label for="tagDescription">标签描述</label>
                        <input type="text" class="form-control @error('description') is-invalid @enderror" id="tagDescription" name="description" aria-describedby="tagDescriptionHelp">
                        <small id="tagDescriptionHelp" class="form-text text-muted">标签描述</small>
                        @error('description')
                            <div class="alert alert-danger">{{ $message }}</div>
                        @enderror
                      </div>
                      <button type="submit" class="btn btn-primary">提交</button>
                    </form>
                    <!-- 这种是显示所有错误信息 -->
                    <div style="display: none;">
                    @if ($errors->any())
                        <div class="alert alert-danger">
                            <ul>
                                @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                    @endif
                    </div>
                </div>
            </div>

            <hr>

            <div class="card">
                <div class="card-header">分类</div>

                <div class="card-body">
                    <p><a href="/categories">分类列表</a></p>
                </div>
            </div>

            <div class="card">
                <div class="card-header">标签</div>

                <div class="card-body">
                    <p><a href="/tags">标签列表</a></p>
                </div>
            </div>

            <div class="card">
                <div class="card-header">文章</div>

                <div class="card-body">
                    <p><a href="/posts">文章列表</a></p>
                </div>
            </div>

            <div class="card">
                <div class="card-header">评论</div>

                <div class="card-body">
                    <p><a href="/comments">评论列表</a></p>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
